<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-name" data-rule="required" class="form-control selectpicker" name="row[name]">
                {foreach name="courseList" item="vo" key="k"}
                <option value="{$k}">{$vo}</option>
                {/foreach}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label for="c-cover" class="control-label col-xs-12 col-sm-2">课程封面:</label>
        <div class="col-xs-12 col-sm-8" id="div-cover">
            <div class="form-inline">
                <input id="c-cover" class="form-control" size="38" name="row[cover]" type="text" value=""
                       data-tip="">
                <span><button type="button" id="plupload-cover" class="btn btn-danger plupload"
                              data-input-id="c-cover" data-mimetype="image/*" data-multiple="false"
                              data-preview-id="p-cover"><i
                        class="fa fa-upload"></i> {:__('Upload')}</button></span>
                <span><button type="button" id="fachoose-cover" class="btn btn-primary fachoose"
                              data-input-id="c-cover" data-mimetype="image/*" data-multiple="false"><i
                        class="fa fa-list"></i> {:__('Choose')}</button></span>
                <span><button type="button" class="btn btn-info ai-generate-image"
                              data-input-id="c-cover" data-preview-id="p-cover"
                              data-prompt-template="为课程生成一张封面图片，课程名称：{course_name}，风格要求：教育类、专业、简洁"
                              data-style="教育类封面"
                              data-size="1024x1024"><i class="fa fa-magic"></i> AI生成</button></span>
                <ul class="row list-inline plupload-preview" id="p-cover"></ul>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label for="c-intro" class="control-label col-xs-12 col-sm-2">课程介绍:</label>
        <div class="col-xs-12 col-sm-8" id="div-intro">
            <div class="form-inline">
                <textarea name="row[intro]" id="c-intro" class="form-control editor" data-rule="" rows="5"
                          data-tip="课程介绍"></textarea>
                <span><button type="button" class="btn btn-info" 
                              data-ai-generate-text="c-intro"
                              data-prompt-template="请为课程'{course_name}'生成一段详细的课程介绍，包括课程目标、主要内容、适用人群等，字数控制在200-300字"
                              data-max-length="300"><i class="fa fa-magic"></i> AI生成</button></span>
            </div>
        </div>
    </div>
    {if !$simplifiedView}
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Community_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-community_id" data-rule="required" class="form-control selectpicker" name="row[community_id]">
                {foreach name="communityList" item="vo" key="k"}
                <option value="{$k}" {if $k==$community_id}selected{/if}>{$vo}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Publicwelfare_id')}:</label>
        <div class="col-xs-12 col-sm-8">
            <select id="c-publicwelfare_id" data-rule="required" class="form-control selectpicker" name="row[publicwelfare_id]">
                {foreach name="publicwelfareList" item="vo" key="k"}
                <option value="{$k}" {if $k==$publicwelfare_id}selected{/if}>{$vo}</option>
                {/foreach}
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-remark" class="form-control" name="row[remark]" rows="5"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_radios('row[status]', ['1'=>__('Status 1'), '0'=>__('Status 0')])}
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
        </div>
    </div>
    {else}
    <!-- 隐藏字段，用于在简化视图中传递参数 -->
    <input type="hidden" name="row[community_id]" value="{$community_id}">
    <input type="hidden" name="row[publicwelfare_id]" value="{$publicwelfare_id}">
    <input type="hidden" name="row[status]" value="1">
    <input type="hidden" name="row[weigh]" value="0">
    {/if}
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>
